<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	    		xmlns:ui="http://java.sun.com/jsf/facelets"
	  			xmlns:h="http://java.sun.com/jsf/html"
	  			xmlns:f="http://java.sun.com/jsf/core"               
                xmlns:cs="http://myfaces.apress.com/custom"
				template="/WEB-INF/layouts/standard.xhtml"
				xmlns:a4j="http://richfaces.org/a4j"
				xmlns:rich="http://richfaces.org/rich"
				xmlns:bf="http://www.bssmanager.com/jsf"
				xmlns:c="http://java.sun.com/jstl/core"
				xmlns:fn="http://java.sun.com/jsp/jstl/functions">

	<ui:define name="headIncludes">
		<style>
			.class11 {
				border-top: 1px solid gray;
			}
			.rc {
				margin:0px;
				border:0px;
				
			}			
			.cc {				
				border:0px;	
				margin:0px;
				padding:0px;			
			}
			td {
				vertical-align: top;
				padding:0px;
				margin:0px;
			}
					
		</style>
	</ui:define>
	
	<ui:define name="content">
		<h:form>			
			<rich:panel id="ddrc" style="border:0px; width:100%">	
							
				<h2 align="center">Daily Deposit and Refund</h2>				
			
				<h:panelGrid columns="2" styleClass="noprint">
							<h:outputText value="Print Last Report: "/>
							<h:outputLink onclick="launchChildWindow('${request.contextPath}/pages/reportDDR.jsf'); return false;">							
								<h:outputText value="#{dailyDepositAndRefundController.model.fromDate == null ? 'N/A': dailyDepositAndRefundController.model.fromDate}" style="background-color: yellow;">
									<f:convertDateTime pattern="dd MMM yy HH:mm" timeZone="#{preferences.timeZone.ID}" />
								</h:outputText>	
							</h:outputLink>						
				</h:panelGrid>
				<rich:spacer height="5"/>
				<h:commandButton value="Generate Report" onclick="if(!showConfirmation('Are you sure to generate report ?')) return false;showLoading();" disabled="#{!dailyDepositAndRefundController.allowGenerate}" id="rpBtn" styleClass="noprint" action="#{dailyDepositAndRefundController.add}"/>
				<rich:spacer height="25"/>
				<h:panelGrid columns="4">
					<h:outputLabel value="From: "/>
					<h:outputText value="#{dailyDepositAndRefundController.model.fromDate == null ? 'N/A':dailyDepositAndRefundController.model.fromDate}" >
						<f:convertDateTime pattern="dd MMM yy HH:mm" timeZone="#{preferences.timeZone.ID}" />
					</h:outputText>
					<h:outputLabel value="To: " style="margin-left:50px;"/>
					<h:outputText value="#{dailyDepositAndRefundController.date}">
						<f:convertDateTime pattern="dd MMM yy HH:mm" timeZone="#{preferences.timeZone.ID}" />
					</h:outputText>
				</h:panelGrid>
				
				<h:panelGrid  columns="5" style="border: solid 1px" width="100%">
					
									
								<rich:dataTable width="100%" value="#{arrayCreator[dailyDepositAndRefundController.model.rows]}" var="row" style="margin-left:0px;">
									<f:facet name="header">
										<h:outputLabel value="-"/>
									</f:facet>
									<rich:column>
										<f:facet name="header">
											S/N
										</f:facet>
										<h:outputText value="#{row}"/>	
									</rich:column>								
									<f:facet name="footer">
										<h:outputText value="-" style="float:right;"/>
									</f:facet>					
								</rich:dataTable>	
								
								
									
									<rich:dataTable width="100%" value="#{dailyDepositAndRefundController.model.roomDeposits}" var="rdr"  >
										<f:facet name="header">
											<h:outputLabel value="Room Deposit"/>
										</f:facet>
										<rich:column>
											<f:facet name="header">
												<h:outputText value="ID"/>
											</f:facet>
											<h:outputText value="#{rdr.payable.id == 0 ? '-':rdr.payable.id}"/>
										</rich:column>
										<rich:column >
											<f:facet name="header">
												<h:outputText value="Amount"/>
											</f:facet>
											<h:outputText value="#{rdr.amount == null ? '-' : rdr.amount}" style="float:right"/>
										</rich:column>	
										<f:facet name="footer">
											<h:outputText value="#{dailyDepositAndRefundController.model.roomDepositTotal}" style="float:right;"/>
										</f:facet>									
									</rich:dataTable>
									
									<rich:dataTable width="100%"  value="#{dailyDepositAndRefundController.model.roomRefunds}" var="rdr"  >
										<f:facet name="header">
											<h:outputLabel value="Room Refund"/>
										</f:facet>
										<rich:column>
											<f:facet name="header">
												<h:outputText value="ID"/>
											</f:facet>
											<h:outputText value="#{rdr.payable.id == 0 ? '-' : rdr.payable.id}"/>
										</rich:column>
										<rich:column >
											<f:facet name="header">
												<h:outputText value="Amount"/>
											</f:facet>
											<h:outputText value="#{rdr.amount == null ? '-' : rdr.amount}" style="float:right"/>
										</rich:column>	
										<f:facet name="footer">
											<h:outputText value="#{dailyDepositAndRefundController.model.roomRefundTotal}" style="float:right;"/>
										</f:facet>									
									</rich:dataTable>
									
									<rich:dataTable width="100%"  value="#{dailyDepositAndRefundController.model.utensilDeposits}" var="rdr"  >
										<f:facet name="header">
											<h:outputLabel value="Utensil Deposits"/>
										</f:facet>
										<rich:column>
											<f:facet name="header">
												<h:outputText value="ID"/>
											</f:facet>
											<h:outputText value="#{rdr.payable.id == 0 ? '-' : rdr.payable.id}"/>
										</rich:column>
										<rich:column >
											<f:facet name="header">
												<h:outputText value="Amount"/>
											</f:facet>
											<h:outputText value="#{rdr.amount == null ? '-' : rdr.amount}" style="float:right"/>
										</rich:column>	
										<f:facet name="footer">
											<h:outputText value="#{dailyDepositAndRefundController.model.utensilDepositTotal}" style="float:right;"/>
										</f:facet>									
									</rich:dataTable>
									
									<rich:dataTable width="100%"  value="#{dailyDepositAndRefundController.model.utensilRefunds}" var="rdr" >
										<f:facet name="header">
											<h:outputLabel value="Utensil Refunds"/>
										</f:facet>
										<rich:column>
											<f:facet name="header">
												<h:outputText value="ID"/>
											</f:facet>
											<h:outputText value="#{rdr.payable.id == 0 ? '-' : rdr.payable.id}"/>
										</rich:column>
										<rich:column >
											<f:facet name="header">
												<h:outputText value="Amount"/>
											</f:facet>
											<h:outputText value="#{rdr.amount == null ? '-' : rdr.amount}" style="float:right"/>
										</rich:column>
										<f:facet name="footer">
											<h:outputText value="#{dailyDepositAndRefundController.model.utensilRefundTotal}" style="float:right;"/>
										</f:facet>										
									</rich:dataTable>
									
									
									
					</h:panelGrid>
					
					<h:panelGrid  columns="1" style="border: solid 1px" width="100%">
								
				<rich:dataTable width="100%"  value="#{dailyDepositAndRefundController.model.cashBalanceData}" var="rdr" >
										<f:facet name="header">
											<h:outputLabel value="Cash Balance"/>
										</f:facet>
										<rich:column>
											<f:facet name="header">
												<h:outputText value="-"/>
											</f:facet>
											<h:outputText value="#{rdr.header}"/>
										</rich:column>
										<rich:column>
											<f:facet name="header">
												<h:outputText value="Deposit"/>
											</f:facet>
											<h:outputText value="#{rdr.deposit}" style="float:right;"/>
										</rich:column>
										<rich:column >
											<f:facet name="header">
												<h:outputText value="Refund"/>
											</f:facet>
											<h:outputText value="#{rdr.refund}" style="float:right;"/>
										</rich:column>
										<rich:column>
											<f:facet name="header">
												<h:outputText value="Balance"/>
											</f:facet>
											<h:outputText value="#{rdr.balance}" style="float:right;"/>
										</rich:column>
										<rich:column >
											<f:facet name="header">
												<h:outputText value="Opening"/>
											</f:facet>
											<h:outputText value="#{rdr.opening}" style="float:right;"/>
										</rich:column>
										<rich:column >
											<f:facet name="header">
												<h:outputText value="Closing"/>
											</f:facet>
											<h:outputText value="#{rdr.closing}" style="float:right;"/>
										</rich:column>
										<f:facet name="footer">
											<h:outputText value="Final: #{dailyDepositAndRefundController.model.roomDepositTotal - dailyDepositAndRefundController.model.roomRefundTotal + dailyDepositAndRefundController.model.utensilDepositTotal - dailyDepositAndRefundController.model.utensilRefundTotal}" style="float:right;"/>
										</f:facet>
									</rich:dataTable>
									</h:panelGrid>
											
			</rich:panel>				
		</h:form>		
	</ui:define>
</ui:composition>